var t,
  a,
  e = require("../../@babel/runtime/helpers/defineProperty"),
  n = require("../../res/www.a9a.cn.js"),
  i = getApp(),
  o = 2,
  s = !0;
Page({
  data: e(
    {
      nTitle: "我的账户",
      div_gzh_box: !1,
      currentTab: "ye",
      mask_class: "alpha0_100",
      div_myinfo_form: !1,
    },
    "mask_class",
    "alpha0_100"
  ),
  onLoad: function (t) {
    var e = this,
      o = this;
    i.get_config("_ZEAI").then(function (t) {
      o.setData({ color: i._ZEAI.color, rgbcolor: n.c16_rgb(i._ZEAI.color) });
    });
    var s = "ye" == t.currentTab ? "ye" : t.currentTab;
    (a = t.t),
      "ye" == s || i.empty(s) || this.setData({ currentTab: s }),
      i.get_openid().then(function (t) {
        e.init();
      });
  },
  topbarFn: function (t) {
    var a = t.currentTarget.dataset.var;
    (a = i.empty(a) ? "ye" : a),
      this.setData({ currentTab: a }),
      "mx" == a && this.get_data();
  },
  init: function () {
    var a = this;
    wx.showNavigationBarLoading(),
      (t = wx.getStorageSync("COOK_U")),
      i.ajax({
        url: "tg.php",
        data: { submitok: "MY_MONEY", openid: t.openid },
        success: function (t) {
          var e = i.empty(a.data.currentTab) ? "ye" : a.data.currentTab;
          if ((a.setData({ currentTab: e }), 1 == t.flag)) {
            var n = !!i.empty(t.D.cook_tg_gzh_openid);
            a.setData({
              nTitle: t.nTitle,
              D: t.D,
              msg_nav: t.msg_nav,
              div_gzh_box: n,
              MB: t.MB,
            }),
              wx.setNavigationBarTitle({ title: t.nTitle }),
              "mx" == e && a.get_data();
          } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          wx.hideNavigationBarLoading();
        },
      });
  },
  txbtnsubmitFn: function (a) {
    var o = this;
    if (
      (n.empty(o.data.MB) || i.openSetting(o.data.MB),
      (t = wx.getStorageSync("COOK_U")),
      i.empty(this.data.D.cook_tg_gzh_openid))
    )
      this.setData({ div_gzh_box: !0 });
    else {
      o = this;
      var s = a.detail.value.money;
      if (i.empty(s))
        return void wx.showToast({
          title: "请选择【提现金额】",
          icon: "none",
          mask: !0,
        });
      i.ajax({
        url: "tg.php",
        data: { submitok: "MY_MONEY_TX_update", tx_money: s, openid: t.openid },
        success: function (t) {
          1 == t.flag
            ? wx.showModal({
                content: t.msg,
                confirmColor: o.data.color,
                confirmText: "朕知道了",
                showCancel: !1,
                success: function (a) {
                  wx.vibrateShort({ type: "heavy" }),
                    o.setData(e({ currentTab: "mx" }, "D.money", t.money)),
                    o.get_data();
                },
              })
            : wx.showToast({ title: t.msg, icon: "none", mask: !0 }),
            wx.hideNavigationBarLoading();
        },
      });
    }
  },
  get_data: function () {
    s = !1;
    var n = this;
    (t = wx.getStorageSync("COOK_U")),
      wx.showNavigationBarLoading(),
      i.ajax({
        url: "tg.php",
        data: { submitok: "MY_MONEY_MX", t: a, openid: t.openid },
        success: function (t) {
          var a = t.LIST;
          if (1 == t.flag) {
            var i;
            if (
              (a.length >= 15 &&
                n.setData({ loading_flag: !0, loading_ico_flag: !0 }),
              0 == a.length)
            )
              n.setData({ loading_flag: !1, nodatabox: !0 });
            else
              n.setData(
                (e((i = {}), "LIST[0]", a),
                e(i, "nodatabox", !1),
                e(i, "loading_flag", !1),
                i)
              );
            s = !0;
          } else
            wx.showModal({
              content: t.msg,
              confirmColor: n.data.color,
              confirmText: "朕知道了",
              showCancel: !1,
              success: function (t) {},
            });
          wx.hideNavigationBarLoading();
        },
      });
  },
  ljtxFn: function () {
    n.empty(this.data.MB) || i.openSetting(this.data.MB),
      this.setData({ currentTab: "tx" });
  },
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        t.setData({ currentTab: "ye" }),
          (o = 2),
          (a = ""),
          wx.stopPullDownRefresh(),
          t.init();
      }, 500);
  },
  onReachBottom: function () {
    if (0 != this.data.currentTab) {
      var n = this,
        r = this.data.LIST;
      s &&
        ((s = !1),
        n.setData({ loading_ico_flag: !0 }),
        i.ajax({
          url: "tg.php",
          data: { submitok: "MY_MONEY_MX", p: o, t: a, openid: t.openid },
          success: function (t) {
            var a = t.LIST;
            if (a.length < 1)
              return (
                n.setData({
                  loading_flag: !0,
                  loading_ico_flag: !1,
                  loading_str: "已全部加载完成",
                }),
                void (s = !1)
              );
            n.setData(e({}, "LIST[" + r.length + "]", a)), (o += 1), (s = !0);
          },
        }));
    }
  },
  mask_closeFn: function (t) {
    var a = this,
      n = t.currentTarget.dataset.maskid;
    this.setData({ mask_class: "alpha100_0" }),
      setTimeout(function () {
        var t;
        a.setData(
          (e((t = {}), n, !1),
          e(t, "mask_class", "alpha0_100"),
          e(t, "div_gzh_box", !1),
          t)
        );
      }, 500);
  },
  emptyFn: function () {},
  my_info_closeFn: function () {
    this.setData({ div_myinfo_form: !1 });
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/tg/my_money",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "",
      path: "/pages/tg/my_money",
    };
  },
});
